package cn.wolfcode.car.business.query;

import cn.wolfcode.car.common.base.query.QueryObject;
import lombok.Getter;
import lombok.Setter;
import org.springframework.format.annotation.DateTimeFormat;

import java.util.Calendar;
import java.util.Date;

@Getter
@Setter
public class StatementQuery extends QueryObject {
    @DateTimeFormat(pattern = "yyyy-MM-dd")
    private Date startDateTime;
    @DateTimeFormat(pattern = "yyyy-MM-dd")
    private Date endDateTime;

    public Date getEndDateTime(){
        if(endDateTime!=null){
            Calendar c = Calendar.getInstance();
            c.setTime(endDateTime);
            c.add(Calendar.DAY_OF_MONTH,1);
            return c.getTime();
        }
        return null;
    }
}
